<?php
function m($a){
  echo $a . '<br/>';
}
class Actor {
  public $package  = array( );
  public $hp = 100;
  public $mp = 100;
  public function run (){
    m("actor run");
}
public function fire($monster){
  m(" actor fire");
    $monster->hp = $monster->hp - 10;
    if($monster->hp>0){
      $monster->fire($this);
    }
    $monster->fire($this);
}
public function use_equ(){
  m("use ...");
}
public function be_fire($A){
  $this->hp = $this->hp-$A;
}
}
class Monster {
  public $hp = 200;
  public function run (){
  echo "monster run";
  }
  public function fire($act){
        echo "monster fire....<br/>";
        $act->hp = $act->hp -5;
  }

}

$act = new Actor;
$monsters = array();
for ($i=0;$i<10;$i++){
  $monsters[] = new Monster;
}

// var_dump($monster);
for($i=0;$i<100;$i++){
  if($monsters[0]->hp<=0){
    m("monster death");
    break;
  }
  m("monster hp:". $monsters[0]->hp);
  $act->fire($monsters[0]);
}
m("act:". $act->hp);
m("Monster:".$monsters[0]->hp);
m("");
